@echo off
del *.dcu /s /q
del *.~* /s /q
del ~*.* /s /q

if not exist ver.txt echo 0.0> ver.txt

if "%1"=="" for /f "tokens=1 delims=." %%i in (ver.txt) do set MajorVersion=%%i

if not "%1"=="" set MajorVersion=%1

for /f "tokens=2 delims=." %%j in (ver.txt) do set /a MinorVersion=%%j+1

echo %MajorVersion%.%MinorVersion% > ver.txt

for /f "delims=\" %%i in ('echo %cd%') do set currDir=%%~ni

rar a -esh -x*\.svn\* %currDir%-%MajorVersion%.%MinorVersion%-src.zip source

rar a -esh -x*\.svn\* %currDir%-%MajorVersion%.%MinorVersion%-bin.zip bin

echo Build Ver %MajorVersion%.%MinorVersion% 